<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
<meta name="format-detection"
	content="telephone=no,email=no,date=no,address=no">
<title></title>
<link rel="stylesheet" type="text/css" href="../css/aui.css" />
<style type="text/css">
.aui-list .aui-list-item i.aui-iconfont {
	-webkit-align-self: center;
	align-self: center;
	font-size: 18px;
}
</style>
</head>
<body>
	<header class="aui-bar aui-bar-nav aui-bar-warning" id="aui-header">
	<a class="aui-pull-left" onclick="window.history.back(-1);"> <span
		class="aui-iconfont aui-icon-left"></span>
	</a>
	<div class="aui-title">通讯录</div>
	<a class="aui-pull-right"> </a> </header>

	<section class="aui-content">
			<ul class="aui-list aui-media-list" id="nice-articles" >
		<!--		<li class="aui-list-item aui-list-item-middle" onclick="openDetailed()">
					<div class="aui-media-list-item-inner">
						<div class="aui-list-item-media" style="width: 3rem;">
							<img src="../image/bing.png" class="aui-img-round aui-list-img-sm">
						</div>
						<div class="aui-list-item-inner aui-list-item-arrow">
							<div class="aui-list-item-text">
								<div class="aui-list-item-title aui-font-size-14">
									广州总部(21)
								</div>
								<div class="aui-list-item-right"></div>
							</div>
							<div class="aui-list-item-text">
								私人银行
							</div>
						</div>
					</div>
				</li>-->
			</ul>
</body>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript">
	$(function() {
		getPage(id);
	});

	//当前初始页
	var pageNumber = 1;
	//每页显示多少条
	var pageSize = 10;
	var countSize = 0;
	//得到选择的id
	var id = "${param.id}";
	function getPage(id) {
		$.ajax({
					url : '${pageContext.request.contextPath}/branchPhonebookList.do?oper=team&deptId='+id,
					type : "POST",
					dataType : "json",
					success : function(data) {
						var html = "";
						if (data.code == "1" && data.code != "undefined") {
							if (typeof (data.data) != "undefined") {
								var da = data.data;
								var user = data.user;
								for (var i = 0; i < da.length; i++) {
									html += "<li class=\"aui-list-item aui-list-item-middle\" onclick=\"openDetailed('";
									if (user.team != null && user.team.branchId == da[i].branchId) {
										html += da[i].branchId;
									}
		//							else if(user.branch==null && user.team==null){
		//									html += "699";
		//							}
									html += "')\"><div class=\"aui-media-list-item-inner\">";
									html += "<div class=\"aui-list-item-media\" style=\"width: 3rem;\"><img src=\"${pageContext.request.contextPath}/img//bing.png\" class=\"aui-img-round aui-list-img-sm\"></div>";
									if (user.team != null && user.team.branchId == da[i].branchId) {
										html += "<div class=\"aui-list-item-inner aui-list-item-arrow\">";
		//							} else if(user.branch==null && user.team==null){
		//									html += "<div class=\"aui-list-item-inner aui-list-item-arrow\">";
									}else {
										html += "<div class=\"aui-list-item-inner\">";
									}
									html += "<div class=\"aui-list-item-text\"><div class=\"aui-list-item-title aui-font-size-14\">";
									html += da[i].branchName + "(" + da[i].employeeCount + ")"
									html += "</div><div class=\"aui-list-item-right\"></div></div>";
									html += "<div class=\"aui-list-item-text\">";
									html += "</div></div></div></li>";
								}
								
								if(data.data.length == 0)
								{
									html = "<p style=\"font-size: 1rem;text-align: center;margin-top: 40%;\">暂无数据</p>";
									$("#nice-articles").removeClass("aui-list");
								}
								//countSize = da.total;
								//复制总记录数
							} else {
									html = "<p style=\"font-size: 1rem;text-align: center;margin-top: 40%;\">暂无数据</p>";
									$("#nice-articles").removeClass("aui-list");
							}
							$("#nice-articles").html(html);
						}
					}
				});
	}
	//打开详细
	function openDetailed(id) {
		window.location.href = "public_phonebook.do?path=phonebook_teamlist&id="
				+ id;
	}

	function toDate(data) {
		var date = new Date(data);
		var y = date.getFullYear();
		var m = date.getMonth() + 1;
		m = m < 10 ? '0' + m : m;
		var d = date.getDate();
		d = d < 10 ? ('0' + d) : d;
		return y + '-' + m + '-' + d;
	}
</script>
</html>